<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>夺宝期</title>
<link href="${base}/resource/admin/css/common.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="${base}/resource/admin/js/jquery.js"></script>
<script type="text/javascript" src="${base}/resource/admin/js/common.js"></script>
<script type="text/javascript" src="${base}/resource/admin/js/list.js"></script>
<script type="text/javascript" src="${base}/resource/admin/datePicker/WdatePicker.js"></script>
<script type="text/javascript" src="/resource/admin/layer/layer.js"></script>
<script type="text/javascript">
$().ready(function() {
	 [@flash_message /]
});
</script>
</head>
<body>
    <!-- 地址导航-->
	<div class="path">
		<a href="/admin/common/index">首页</a> &raquo;夺宝商品<span>${page.total}</span>
	</div>
    <!-- 主体-->
	<form id="listForm" action="listAll" method="get">
        <div class="searchBar">
            <table class="searchContent">
                <tr>
                    <td>
                        夺宝期号：<input type="text" name="eq_timesNo" class="text" value="${eq_timesNo}" />
                    </td>
                    <td>
                        夺宝商品：
                        <select name="eq_long_dbProduct.id" class="text" id="dbProductSel">
                            <option value="">所有</option>
                        [#list dbProductList as dbProduct]
                            <option value="${dbProduct.id}" [#if dbProduct.id==eq_long_dbProduct_id] selected="selected" [/#if]>${dbProduct.name}</option>
                        [/#list]
                        </select>
                    </td>
                    <td>
                        开始时间：<input type="text" id="beginDate" name="gt_datetime_endDate" class="text Wdate" readonly="readonly"  value="[#if gt_datetime_endDate??]${gt_datetime_endDate?string("yyyy-MM-dd HH:mm:ss")}[/#if]" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss', maxDate: '#F{$dp.$D(\'endDate\')}' });"/>
                    </td>
                    <td>
                        结束时间：<input type="text" id="endDate" name="lt_datetime_endDate" class="text Wdate"  readonly="readonly"   value="[#if lt_datetime_endDate??]${lt_datetime_endDate?string("yyyy-MM-dd HH:mm:ss")}[/#if]"  onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',minDate: '#F{$dp.$D(\'beginDate\')}',maxDate: '${currentDate}'});"/>
                    </td>
                    <td>
                        <button type="submit">检索</button>
                    </td>
                    </tr><tr>

                <td>
                    中奖手机号：<input type="text" name="eq_lotteryMobile" class="text" value="${eq_lotteryMobile}" />
                </td>
                <td>
                    是否开奖：<select name="eq_bool_isLottery" class="text">
                    <option value="">所有</option>
                    <option value="0"  [#if eq_bool_isLottery??&&eq_bool_isLottery==false]selected='selected'[/#if]>否</option>
                    <option value="1"  [#if eq_bool_isLottery??&&eq_bool_isLottery==true]selected='selected'[/#if]>是</option>
                </select>
                </td>


                </tr>
            </table>
        </div>
		<div class="bar">
			<div class="buttonWrap">
                <a href="export" class="iconButton" id="exportExcel">
                    <span class="downIcon">&nbsp;</span>导出
                </a>
				<a href="javascript:;" id="deleteButton" class="iconButton disabled">
					<span class="deleteIcon">&nbsp;</span>删除
				</a>
				<a href="javascript:;" id="refreshButton" class="iconButton">
					<span class="refreshIcon">&nbsp;</span>刷新
				</a>
				<div class="menuWrap">
					<a href="javascript:;" id="pageSizeSelect" class="button">
					    每页条数<span class="arrow">&nbsp;</span>
					</a>
                    <div class="popupMenu">
                        <ul id="pageSizeOption">
                            <li>
                                <a href="javascript:;"[#if page.numPerPage == 10] class="current"[/#if] val="10">10</a>
                            </li>
                            <li>
                                <a href="javascript:;"[#if page.numPerPage == 20] class="current"[/#if] val="20">20</a>
                            </li>
                            <li>
                                <a href="javascript:;"[#if page.numPerPage == 50] class="current"[/#if] val="50">50</a>
                            </li>
                            <li>
                                <a href="javascript:;"[#if page.numPerPage == 100] class="current"[/#if] val="100">100</a>
                            </li>
                        </ul>
                    </div>
				</div>
			</div>
		</div>
		<table id="listTable" class="list">
			<tr>
				<th class="check">
					<input type="checkbox" id="selectAll" />
				</th>
				<th>
                    <span>夺宝商品</span>
				</th>
                <th>
                    <span>夺宝进度</span>
                </th>
                <th>
                    <span>单份金额</span>
                </th>
                <th>
                    <span>限购数量</span>
                </th>
                <th>
                    <span>当前期数</span>
                </th>
                <th>
                    <span>开始时间</span>
                </th>
                <th>
                    <span>结束时间</span>
                </th>
                <th>
                    <span>中奖订单</span>
                </th>
                <th>
                    <span>创建时间</span>
                </th>
                <th>操作</th>
			</tr>
			[#list page.content as entity]
				<tr>
					<td>
						<input type="checkbox" name="ids" value="${entity.id}" />
					</td>
					<td>
						<a href="">${entity.dbProduct.name}</a>
					</td>
                    <td>
                        ${entity.currentQuantity/entity.quantity}（${entity.currentQuantity}/${entity.quantity}）
                    </td>
                    <td>
                        ${entity.singleAmount}
                    </td>
                    <td>
                        ${entity.purchaseQuantity}
                    </td>
                    <td>
                        ${entity.timesNo}
                    </td>
                    <td>
                        ${entity.startDate}
                    </td>
                    <td>
                        [#if entity.dbOrder??]
                            ${entity.endDate}[#else ]<span style="color: #cc0000;">尚未结束</span>
                        [/#if]

                    </td>
                    <td>
                        [#if entity.dbOrder??]
                            <a href="/dbOrder/edit?id=${entity.dbOrder.id}" style="color: #cc0000;">${entity.dbOrder.mobile}</a> [#else ]<span style="color: #cc0000;">尚未开奖</span>
                        [/#if]
                        [#if entity.dbOrder??]
                            [#if entity.isLottery==true]
                                [#if entity.dbOrder.shippingDate??]
                                    [#if entity.dbOrder.shippingStartDate??]
                                        [#if entity.dbOrder.shippingEndDate]
                                            已经收货
                                        [#else]等待收货
                                        [/#if]
                                    [#else]<a href="/dbTimes/shipping?id=${entity.dbOrder.id}" class="layer-dialog">马上发货</a>
                                    [/#if]
                                [#else]等待确认地址<a href="/dbTimes/lotterySMS?id=${entity.id}" class="button-send-lotterySMS">补发短信提醒</a>
                                [/#if]
                            [/#if]
                        [/#if]
                    </td>
                    <td>
                       ${entity.createDate?string("yyyy-MM-dd HH:mm:ss")}
                    </td>
                    <td>
                        <a href="showedit?id=${entity.id}">[查看]</a>
                        [#if entity.isLottery]
                            [#if entity.dbOrder.isShare??][#else]<a href="/dbShare/view?dbTimesId=${entity.id}">[晒单]</a>[/#if]
                        [/#if]
                    </td>
				</tr>
			[/#list]
		</table>
       [@pagination pageNumber = page.pageNumber totalPages = page.totalPages]
             [#include "/common/pagination.ftl"]
       [/@pagination]
	</form>
<script type="text/javascript">

    $(function(){

        /** 发货...*/
        $(".layer-dialog").click(function(){
            var url=$(this).attr("href");
            layer.open({
                type: 2,
                area: ['650px', '600px'],
                fix: false, //不固定
                maxmin: true,
                content: url
            });
            return false;
        });
    });
</script>
    <script type="text/javascript">
        $(function(){
            $(".button-send-lotterySMS").click(function(){
                var href=$(this).attr("href");
                $.ajax({
                    url: href,
                    type: "POST",
                    dataType: "json",
                    cache: false,
                    success: function (message) {
                        alert(message.content);
                    }, error: function () {
                        alert('发送异常');
                    }
                });
                return false;

            });
        });
    </script>

    <script type="text/javascript">
        $(function() {
            $("#exportExcel").click(function () {
                var $form = $("#listForm");
                $form.attr("action", "/dbTimes/export.do")
                $form.submit();
                return false;
            });
        });

    </script>
</body>
</html>